\(\int \cot ^4(c+d x) (a+b \sin (c+d x))^2 \, dx\) [1111]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F(-1)]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 21, antiderivative size = 133 \[ \int \cot ^4(c+d x) (a+b \sin (c+d x))^2 \, dx=a^2 x-\frac {3 b^2 x}{2}+\frac {3 a b \text {arctanh}(\cos (c+d x))}{d}-\frac {3 a b \cos (c+d x)}{d}+\frac {a^2 \cot (c+d x)}{d}-\frac {3 b^2 \cot (c+d x)}{2 d}+\frac {b^2 \cos ^2(c+d x) \cot (c+d x)}{2 d}-\frac {a b \cos (c+d x) \cot ^2(c+d x)}{d}-\frac {a^2 \cot ^3(c+d x)}{3 d} \]

[Out]

a^2*x-3/2*b^2*x+3*a*b*arctanh(cos(d*x+c))/d-3*a*b*cos(d*x+c)/d+a^2*cot(d*x+c)/d-3/2*b^2*cot(d*x+c)/d+1/2*b^2*c
os(d*x+c)^2*cot(d*x+c)/d-a*b*cos(d*x+c)*cot(d*x+c)^2/d-1/3*a^2*cot(d*x+c)^3/d

Rubi [A] (verified)

Time = 0.12 (sec) , antiderivative size = 133, normalized size of antiderivative = 1.00, number of steps used = 13, number of rules used = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.429, Rules used = {2801, 2671, 294, 327, 209, 2672, 212, 3554, 8} \[ \int \cot ^4(c+d x) (a+b \sin (c+d x))^2 \, dx=-\frac {a^2 \cot ^3(c+d x)}{3 d}+\frac {a^2 \cot (c+d x)}{d}+a^2 x+\frac {3 a b \text {arctanh}(\cos (c+d x))}{d}-\frac {3 a b \cos (c+d x)}{d}-\frac {a b \cos (c+d x) \cot ^2(c+d x)}{d}-\frac {3 b^2 \cot (c+d x)}{2 d}+\frac {b^2 \cos ^2(c+d x) \cot (c+d x)}{2 d}-\frac {3 b^2 x}{2} \]

[In]

Int[Cot[c + d*x]^4*(a + b*Sin[c + d*x])^2,x]

[Out]

a^2*x - (3*b^2*x)/2 + (3*a*b*ArcTanh[Cos[c + d*x]])/d - (3*a*b*Cos[c + d*x])/d + (a^2*Cot[c + d*x])/d - (3*b^2
*Cot[c + d*x])/(2*d) + (b^2*Cos[c + d*x]^2*Cot[c + d*x])/(2*d) - (a*b*Cos[c + d*x]*Cot[c + d*x]^2)/d - (a^2*Co
t[c + d*x]^3)/(3*d)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 294

Int[((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[c^(n - 1)*(c*x)^(m - n + 1)*((a + b*x^
n)^(p + 1)/(b*n*(p + 1))), x] - Dist[c^n*((m - n + 1)/(b*n*(p + 1))), Int[(c*x)^(m - n)*(a + b*x^n)^(p + 1), x
], x] /; FreeQ[{a, b, c}, x] && IGtQ[n, 0] && LtQ[p, -1] && GtQ[m + 1, n] &&  !ILtQ[(m + n*(p + 1) + 1)/n, 0]
&& IntBinomialQ[a, b, c, n, m, p, x]

Rule 327

Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[c^(n - 1)*(c*x)^(m - n + 1)*((a + b*x^n
)^(p + 1)/(b*(m + n*p + 1))), x] - Dist[a*c^n*((m - n + 1)/(b*(m + n*p + 1))), Int[(c*x)^(m - n)*(a + b*x^n)^p
, x], x] /; FreeQ[{a, b, c, p}, x] && IGtQ[n, 0] && GtQ[m, n - 1] && NeQ[m + n*p + 1, 0] && IntBinomialQ[a, b,
 c, n, m, p, x]

Rule 2671

Int[sin[(e_.) + (f_.)*(x_)]^(m_)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> With[{ff = FreeFactors[Ta
n[e + f*x], x]}, Dist[b*(ff/f), Subst[Int[(ff*x)^(m + n)/(b^2 + ff^2*x^2)^(m/2 + 1), x], x, b*(Tan[e + f*x]/ff
)], x]] /; FreeQ[{b, e, f, n}, x] && IntegerQ[m/2]

Rule 2672

Int[((a_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*tan[(e_.) + (f_.)*(x_)]^(n_.), x_Symbol] :> With[{ff = FreeFactors[S
in[e + f*x], x]}, Dist[ff/f, Subst[Int[(ff*x)^(m + n)/(a^2 - ff^2*x^2)^((n + 1)/2), x], x, a*(Sin[e + f*x]/ff)
], x]] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n + 1)/2]

Rule 2801

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((g_.)*tan[(e_.) + (f_.)*(x_)])^(p_.), x_Symbol] :> Int[Expan
dIntegrand[(g*Tan[e + f*x])^p, (a + b*Sin[e + f*x])^m, x], x] /; FreeQ[{a, b, e, f, g, p}, x] && NeQ[a^2 - b^2
, 0] && IGtQ[m, 0]

Rule 3554

Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((b*Tan[c + d*x])^(n - 1)/(d*(n - 1))), x] - Dis
t[b^2, Int[(b*Tan[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1]

Rubi steps \begin{align*} \text {integral}& = \int \left (b^2 \cos ^2(c+d x) \cot ^2(c+d x)+2 a b \cos (c+d x) \cot ^3(c+d x)+a^2 \cot ^4(c+d x)\right ) \, dx \\ & = a^2 \int \cot ^4(c+d x) \, dx+(2 a b) \int \cos (c+d x) \cot ^3(c+d x) \, dx+b^2 \int \cos ^2(c+d x) \cot ^2(c+d x) \, dx \\ & = -\frac {a^2 \cot ^3(c+d x)}{3 d}-a^2 \int \cot ^2(c+d x) \, dx-\frac {(2 a b) \text {Subst}\left (\int \frac {x^4}{\left (1-x^2\right )^2} \, dx,x,\cos (c+d x)\right )}{d}-\frac {b^2 \text {Subst}\left (\int \frac {x^4}{\left (1+x^2\right )^2} \, dx,x,\cot (c+d x)\right )}{d} \\ & = \frac {a^2 \cot (c+d x)}{d}+\frac {b^2 \cos ^2(c+d x) \cot (c+d x)}{2 d}-\frac {a b \cos (c+d x) \cot ^2(c+d x)}{d}-\frac {a^2 \cot ^3(c+d x)}{3 d}+a^2 \int 1 \, dx+\frac {(3 a b) \text {Subst}\left (\int \frac {x^2}{1-x^2} \, dx,x,\cos (c+d x)\right )}{d}-\frac {\left (3 b^2\right ) \text {Subst}\left (\int \frac {x^2}{1+x^2} \, dx,x,\cot (c+d x)\right )}{2 d} \\ & = a^2 x-\frac {3 a b \cos (c+d x)}{d}+\frac {a^2 \cot (c+d x)}{d}-\frac {3 b^2 \cot (c+d x)}{2 d}+\frac {b^2 \cos ^2(c+d x) \cot (c+d x)}{2 d}-\frac {a b \cos (c+d x) \cot ^2(c+d x)}{d}-\frac {a^2 \cot ^3(c+d x)}{3 d}+\frac {(3 a b) \text {Subst}\left (\int \frac {1}{1-x^2} \, dx,x,\cos (c+d x)\right )}{d}+\frac {\left (3 b^2\right ) \text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\cot (c+d x)\right )}{2 d} \\ & = a^2 x-\frac {3 b^2 x}{2}+\frac {3 a b \text {arctanh}(\cos (c+d x))}{d}-\frac {3 a b \cos (c+d x)}{d}+\frac {a^2 \cot (c+d x)}{d}-\frac {3 b^2 \cot (c+d x)}{2 d}+\frac {b^2 \cos ^2(c+d x) \cot (c+d x)}{2 d}-\frac {a b \cos (c+d x) \cot ^2(c+d x)}{d}-\frac {a^2 \cot ^3(c+d x)}{3 d} \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(293\) vs. \(2(133)=266\).

Time = 6.09 (sec) , antiderivative size = 293, normalized size of antiderivative = 2.20 \[ \int \cot ^4(c+d x) (a+b \sin (c+d x))^2 \, dx=\frac {\left (2 a^2-3 b^2\right ) (c+d x)}{2 d}-\frac {2 a b \cos (c+d x)}{d}+\frac {\left (4 a^2 \cos \left (\frac {1}{2} (c+d x)\right )-3 b^2 \cos \left (\frac {1}{2} (c+d x)\right )\right ) \csc \left (\frac {1}{2} (c+d x)\right )}{6 d}-\frac {a b \csc ^2\left (\frac {1}{2} (c+d x)\right )}{4 d}-\frac {a^2 \cot \left (\frac {1}{2} (c+d x)\right ) \csc ^2\left (\frac {1}{2} (c+d x)\right )}{24 d}+\frac {3 a b \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )}{d}-\frac {3 a b \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )}{d}+\frac {a b \sec ^2\left (\frac {1}{2} (c+d x)\right )}{4 d}+\frac {\sec \left (\frac {1}{2} (c+d x)\right ) \left (-4 a^2 \sin \left (\frac {1}{2} (c+d x)\right )+3 b^2 \sin \left (\frac {1}{2} (c+d x)\right )\right )}{6 d}-\frac {b^2 \sin (2 (c+d x))}{4 d}+\frac {a^2 \sec ^2\left (\frac {1}{2} (c+d x)\right ) \tan \left (\frac {1}{2} (c+d x)\right )}{24 d} \]

[In]

Integrate[Cot[c + d*x]^4*(a + b*Sin[c + d*x])^2,x]

[Out]

((2*a^2 - 3*b^2)*(c + d*x))/(2*d) - (2*a*b*Cos[c + d*x])/d + ((4*a^2*Cos[(c + d*x)/2] - 3*b^2*Cos[(c + d*x)/2]
)*Csc[(c + d*x)/2])/(6*d) - (a*b*Csc[(c + d*x)/2]^2)/(4*d) - (a^2*Cot[(c + d*x)/2]*Csc[(c + d*x)/2]^2)/(24*d)
+ (3*a*b*Log[Cos[(c + d*x)/2]])/d - (3*a*b*Log[Sin[(c + d*x)/2]])/d + (a*b*Sec[(c + d*x)/2]^2)/(4*d) + (Sec[(c
 + d*x)/2]*(-4*a^2*Sin[(c + d*x)/2] + 3*b^2*Sin[(c + d*x)/2]))/(6*d) - (b^2*Sin[2*(c + d*x)])/(4*d) + (a^2*Sec
[(c + d*x)/2]^2*Tan[(c + d*x)/2])/(24*d)

Maple [A] (verified)

Time = 0.57 (sec) , antiderivative size = 145, normalized size of antiderivative = 1.09

method result size
derivativedivides \(\frac {a^{2} \left (-\frac {\left (\cot ^{3}\left (d x +c \right )\right )}{3}+\cot \left (d x +c \right )+d x +c \right )+2 a b \left (-\frac {\cos ^{5}\left (d x +c \right )}{2 \sin \left (d x +c \right )^{2}}-\frac {\left (\cos ^{3}\left (d x +c \right )\right )}{2}-\frac {3 \cos \left (d x +c \right )}{2}-\frac {3 \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )+b^{2} \left (-\frac {\cos ^{5}\left (d x +c \right )}{\sin \left (d x +c \right )}-\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )-\frac {3 d x}{2}-\frac {3 c}{2}\right )}{d}\) \(145\)
default \(\frac {a^{2} \left (-\frac {\left (\cot ^{3}\left (d x +c \right )\right )}{3}+\cot \left (d x +c \right )+d x +c \right )+2 a b \left (-\frac {\cos ^{5}\left (d x +c \right )}{2 \sin \left (d x +c \right )^{2}}-\frac {\left (\cos ^{3}\left (d x +c \right )\right )}{2}-\frac {3 \cos \left (d x +c \right )}{2}-\frac {3 \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )+b^{2} \left (-\frac {\cos ^{5}\left (d x +c \right )}{\sin \left (d x +c \right )}-\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )-\frac {3 d x}{2}-\frac {3 c}{2}\right )}{d}\) \(145\)
parallelrisch \(\frac {-144 \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right ) a b -2 a^{2} \left (\sec ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) \left (\csc ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) \cos \left (3 d x +3 c \right )-18 b \left (\cos \left (d x +c \right )+\frac {5 \cos \left (2 d x +2 c \right )}{6}-\frac {\cos \left (3 d x +3 c \right )}{3}-\frac {5}{6}\right ) \left (\sec ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) a \left (\csc ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-27 b^{2} \left (\cos \left (d x +c \right )-\frac {\cos \left (3 d x +3 c \right )}{9}\right ) \sec \left (\frac {d x}{2}+\frac {c}{2}\right ) \csc \left (\frac {d x}{2}+\frac {c}{2}\right )+48 d x \left (a^{2}-\frac {3 b^{2}}{2}\right )}{48 d}\) \(167\)
risch \(a^{2} x -\frac {3 b^{2} x}{2}+\frac {i b^{2} {\mathrm e}^{2 i \left (d x +c \right )}}{8 d}-\frac {a b \,{\mathrm e}^{i \left (d x +c \right )}}{d}-\frac {a b \,{\mathrm e}^{-i \left (d x +c \right )}}{d}-\frac {i b^{2} {\mathrm e}^{-2 i \left (d x +c \right )}}{8 d}+\frac {4 i a^{2} {\mathrm e}^{4 i \left (d x +c \right )}-2 i b^{2} {\mathrm e}^{4 i \left (d x +c \right )}+2 a b \,{\mathrm e}^{5 i \left (d x +c \right )}-4 i a^{2} {\mathrm e}^{2 i \left (d x +c \right )}+4 i b^{2} {\mathrm e}^{2 i \left (d x +c \right )}+\frac {8 i a^{2}}{3}-2 i b^{2}-2 a b \,{\mathrm e}^{i \left (d x +c \right )}}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{3}}+\frac {3 a b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{d}-\frac {3 a b \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{d}\) \(236\)
norman \(\frac {\left (a^{2}-\frac {3 b^{2}}{2}\right ) x \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (a^{2}-\frac {3 b^{2}}{2}\right ) x \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (2 a^{2}-3 b^{2}\right ) x \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\frac {5 a b \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {5 a b \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {a^{2}}{24 d}+\frac {a^{2} \left (\tan ^{10}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{24 d}+\frac {\left (7 a^{2}-18 b^{2}\right ) \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{12 d}-\frac {\left (7 a^{2}-18 b^{2}\right ) \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{12 d}+\frac {\left (13 a^{2}-12 b^{2}\right ) \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{24 d}-\frac {\left (13 a^{2}-12 b^{2}\right ) \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{24 d}-\frac {a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{4 d}+\frac {a b \left (\tan ^{9}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4 d}}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} \left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2}}-\frac {3 a b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}\) \(320\)

[In]

int(cos(d*x+c)^4*csc(d*x+c)^4*(a+b*sin(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

1/d*(a^2*(-1/3*cot(d*x+c)^3+cot(d*x+c)+d*x+c)+2*a*b*(-1/2/sin(d*x+c)^2*cos(d*x+c)^5-1/2*cos(d*x+c)^3-3/2*cos(d
*x+c)-3/2*ln(csc(d*x+c)-cot(d*x+c)))+b^2*(-1/sin(d*x+c)*cos(d*x+c)^5-(cos(d*x+c)^3+3/2*cos(d*x+c))*sin(d*x+c)-
3/2*d*x-3/2*c))

Fricas [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 218, normalized size of antiderivative = 1.64 \[ \int \cot ^4(c+d x) (a+b \sin (c+d x))^2 \, dx=\frac {3 \, b^{2} \cos \left (d x + c\right )^{5} + 4 \, {\left (2 \, a^{2} - 3 \, b^{2}\right )} \cos \left (d x + c\right )^{3} + 9 \, {\left (a b \cos \left (d x + c\right )^{2} - a b\right )} \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) - 9 \, {\left (a b \cos \left (d x + c\right )^{2} - a b\right )} \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) - 3 \, {\left (2 \, a^{2} - 3 \, b^{2}\right )} \cos \left (d x + c\right ) + 3 \, {\left ({\left (2 \, a^{2} - 3 \, b^{2}\right )} d x \cos \left (d x + c\right )^{2} - 4 \, a b \cos \left (d x + c\right )^{3} - {\left (2 \, a^{2} - 3 \, b^{2}\right )} d x + 6 \, a b \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{6 \, {\left (d \cos \left (d x + c\right )^{2} - d\right )} \sin \left (d x + c\right )} \]

[In]

integrate(cos(d*x+c)^4*csc(d*x+c)^4*(a+b*sin(d*x+c))^2,x, algorithm="fricas")

[Out]

1/6*(3*b^2*cos(d*x + c)^5 + 4*(2*a^2 - 3*b^2)*cos(d*x + c)^3 + 9*(a*b*cos(d*x + c)^2 - a*b)*log(1/2*cos(d*x +
c) + 1/2)*sin(d*x + c) - 9*(a*b*cos(d*x + c)^2 - a*b)*log(-1/2*cos(d*x + c) + 1/2)*sin(d*x + c) - 3*(2*a^2 - 3
*b^2)*cos(d*x + c) + 3*((2*a^2 - 3*b^2)*d*x*cos(d*x + c)^2 - 4*a*b*cos(d*x + c)^3 - (2*a^2 - 3*b^2)*d*x + 6*a*
b*cos(d*x + c))*sin(d*x + c))/((d*cos(d*x + c)^2 - d)*sin(d*x + c))

Sympy [F(-1)]

Timed out. \[ \int \cot ^4(c+d x) (a+b \sin (c+d x))^2 \, dx=\text {Timed out} \]

[In]

integrate(cos(d*x+c)**4*csc(d*x+c)**4*(a+b*sin(d*x+c))**2,x)

[Out]

Timed out

Maxima [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 138, normalized size of antiderivative = 1.04 \[ \int \cot ^4(c+d x) (a+b \sin (c+d x))^2 \, dx=\frac {2 \, {\left (3 \, d x + 3 \, c + \frac {3 \, \tan \left (d x + c\right )^{2} - 1}{\tan \left (d x + c\right )^{3}}\right )} a^{2} - 3 \, {\left (3 \, d x + 3 \, c + \frac {3 \, \tan \left (d x + c\right )^{2} + 2}{\tan \left (d x + c\right )^{3} + \tan \left (d x + c\right )}\right )} b^{2} + 3 \, a b {\left (\frac {2 \, \cos \left (d x + c\right )}{\cos \left (d x + c\right )^{2} - 1} - 4 \, \cos \left (d x + c\right ) + 3 \, \log \left (\cos \left (d x + c\right ) + 1\right ) - 3 \, \log \left (\cos \left (d x + c\right ) - 1\right )\right )}}{6 \, d} \]

[In]

integrate(cos(d*x+c)^4*csc(d*x+c)^4*(a+b*sin(d*x+c))^2,x, algorithm="maxima")

[Out]

1/6*(2*(3*d*x + 3*c + (3*tan(d*x + c)^2 - 1)/tan(d*x + c)^3)*a^2 - 3*(3*d*x + 3*c + (3*tan(d*x + c)^2 + 2)/(ta
n(d*x + c)^3 + tan(d*x + c)))*b^2 + 3*a*b*(2*cos(d*x + c)/(cos(d*x + c)^2 - 1) - 4*cos(d*x + c) + 3*log(cos(d*
x + c) + 1) - 3*log(cos(d*x + c) - 1)))/d

Giac [A] (verification not implemented)

none

Time = 0.50 (sec) , antiderivative size = 241, normalized size of antiderivative = 1.81 \[ \int \cot ^4(c+d x) (a+b \sin (c+d x))^2 \, dx=\frac {a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 6 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 72 \, a b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right ) - 15 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 12 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 12 \, {\left (2 \, a^{2} - 3 \, b^{2}\right )} {\left (d x + c\right )} + \frac {24 \, {\left (b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 4 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 4 \, a b\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )}^{2}} + \frac {132 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 15 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 12 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 6 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - a^{2}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3}}}{24 \, d} \]

[In]

integrate(cos(d*x+c)^4*csc(d*x+c)^4*(a+b*sin(d*x+c))^2,x, algorithm="giac")

[Out]

1/24*(a^2*tan(1/2*d*x + 1/2*c)^3 + 6*a*b*tan(1/2*d*x + 1/2*c)^2 - 72*a*b*log(abs(tan(1/2*d*x + 1/2*c))) - 15*a
^2*tan(1/2*d*x + 1/2*c) + 12*b^2*tan(1/2*d*x + 1/2*c) + 12*(2*a^2 - 3*b^2)*(d*x + c) + 24*(b^2*tan(1/2*d*x + 1
/2*c)^3 - 4*a*b*tan(1/2*d*x + 1/2*c)^2 - b^2*tan(1/2*d*x + 1/2*c) - 4*a*b)/(tan(1/2*d*x + 1/2*c)^2 + 1)^2 + (1
32*a*b*tan(1/2*d*x + 1/2*c)^3 + 15*a^2*tan(1/2*d*x + 1/2*c)^2 - 12*b^2*tan(1/2*d*x + 1/2*c)^2 - 6*a*b*tan(1/2*
d*x + 1/2*c) - a^2)/tan(1/2*d*x + 1/2*c)^3)/d

Mupad [B] (verification not implemented)

Time = 12.68 (sec) , antiderivative size = 584, normalized size of antiderivative = 4.39 \[ \int \cot ^4(c+d x) (a+b \sin (c+d x))^2 \, dx=-\frac {\frac {5\,b^2\,\cos \left (c+d\,x\right )}{16}+\frac {a^2\,\cos \left (3\,c+3\,d\,x\right )}{3}-\frac {11\,b^2\,\cos \left (3\,c+3\,d\,x\right )}{32}+\frac {b^2\,\cos \left (5\,c+5\,d\,x\right )}{32}+\frac {a^2\,\mathrm {atan}\left (\frac {-2\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^2+6\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a\,b+3\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,b^2}{2\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^2+6\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a\,b-3\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,b^2}\right )\,\sin \left (3\,c+3\,d\,x\right )}{2}-\frac {3\,b^2\,\mathrm {atan}\left (\frac {-2\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^2+6\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a\,b+3\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,b^2}{2\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^2+6\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a\,b-3\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,b^2}\right )\,\sin \left (3\,c+3\,d\,x\right )}{4}+\frac {3\,a\,b\,\sin \left (c+d\,x\right )}{2}-\frac {3\,a^2\,\mathrm {atan}\left (\frac {-2\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^2+6\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a\,b+3\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,b^2}{2\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^2+6\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a\,b-3\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,b^2}\right )\,\sin \left (c+d\,x\right )}{2}+\frac {9\,b^2\,\mathrm {atan}\left (\frac {-2\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^2+6\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a\,b+3\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,b^2}{2\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^2+6\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a\,b-3\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,b^2}\right )\,\sin \left (c+d\,x\right )}{4}+a\,b\,\sin \left (2\,c+2\,d\,x\right )-\frac {a\,b\,\sin \left (3\,c+3\,d\,x\right )}{2}-\frac {a\,b\,\sin \left (4\,c+4\,d\,x\right )}{4}+\frac {9\,a\,b\,\sin \left (c+d\,x\right )\,\ln \left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{4}-\frac {3\,a\,b\,\ln \left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\sin \left (3\,c+3\,d\,x\right )}{4}}{d\,{\sin \left (c+d\,x\right )}^3} \]

[In]

int((cos(c + d*x)^4*(a + b*sin(c + d*x))^2)/sin(c + d*x)^4,x)

[Out]

-((5*b^2*cos(c + d*x))/16 + (a^2*cos(3*c + 3*d*x))/3 - (11*b^2*cos(3*c + 3*d*x))/32 + (b^2*cos(5*c + 5*d*x))/3
2 + (a^2*atan((3*b^2*cos(c/2 + (d*x)/2) - 2*a^2*cos(c/2 + (d*x)/2) + 6*a*b*sin(c/2 + (d*x)/2))/(2*a^2*sin(c/2
+ (d*x)/2) - 3*b^2*sin(c/2 + (d*x)/2) + 6*a*b*cos(c/2 + (d*x)/2)))*sin(3*c + 3*d*x))/2 - (3*b^2*atan((3*b^2*co
s(c/2 + (d*x)/2) - 2*a^2*cos(c/2 + (d*x)/2) + 6*a*b*sin(c/2 + (d*x)/2))/(2*a^2*sin(c/2 + (d*x)/2) - 3*b^2*sin(
c/2 + (d*x)/2) + 6*a*b*cos(c/2 + (d*x)/2)))*sin(3*c + 3*d*x))/4 + (3*a*b*sin(c + d*x))/2 - (3*a^2*atan((3*b^2*
cos(c/2 + (d*x)/2) - 2*a^2*cos(c/2 + (d*x)/2) + 6*a*b*sin(c/2 + (d*x)/2))/(2*a^2*sin(c/2 + (d*x)/2) - 3*b^2*si
n(c/2 + (d*x)/2) + 6*a*b*cos(c/2 + (d*x)/2)))*sin(c + d*x))/2 + (9*b^2*atan((3*b^2*cos(c/2 + (d*x)/2) - 2*a^2*
cos(c/2 + (d*x)/2) + 6*a*b*sin(c/2 + (d*x)/2))/(2*a^2*sin(c/2 + (d*x)/2) - 3*b^2*sin(c/2 + (d*x)/2) + 6*a*b*co
s(c/2 + (d*x)/2)))*sin(c + d*x))/4 + a*b*sin(2*c + 2*d*x) - (a*b*sin(3*c + 3*d*x))/2 - (a*b*sin(4*c + 4*d*x))/
4 + (9*a*b*sin(c + d*x)*log(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/4 - (3*a*b*log(sin(c/2 + (d*x)/2)/cos(c/2
+ (d*x)/2))*sin(3*c + 3*d*x))/4)/(d*sin(c + d*x)^3)